<include file="public@header" />
</head>

<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li class="active"><a href="{:url('AdminOrder/index')}">订单管理</a></li>
        </ul>
        <form class="well form-inline margin-top-20" method="post" action="{:url('AdminOrder/index')}">
            <p>
            下单时间:
        <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
               value="{$start_time|default=''}"
               style="width: 140px;" autocomplete="off">-
        <input type="text" class="form-control js-bootstrap-datetime" name="end_time"
               value="{$end_time|default=''}"
               style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
            科目:
            <select class="form-control" name="subject_id" id="subject_id" style="width: 140px;">
                <option value=''>全部</option>
                <foreach name="subjectList" item="vo">
                    <option value="{$vo.id}">{$vo.name}</option>
                </foreach>
            </select> &nbsp;&nbsp;
            课程:
            <select class="form-control" name="course_id" id="course_id" style="width: 140px;">
                <option value=''>全部</option>
                <foreach name="courseList" item="vo">
                    <option value="{$vo.id}">{$vo.title}</option>
                </foreach>
            </select> &nbsp;&nbsp;
            班别:
            <select class="form-control" name="class_id" id="class_id" style="width: 140px;">
                <option value=''>全部</option>
                <foreach name="classList" item="vo">
                    <option value="{$vo.id}">{$vo.name}</option>
                </foreach>
            </select> &nbsp;&nbsp;
            教师:
            <select class="form-control" name="teacher_id" id="teacher_id" style="width: 140px;">
                <option value=''>全部</option>
                <foreach name="teacherList" item="vo">
                    <option value="{$vo.id}">{$vo.name}</option>
                </foreach>
            </select> &nbsp;&nbsp;
        </p>
            <p>
            关键字:
            <input type="text" class="form-control" name="keyword" style="width: 200px;" value="{$keyword|default=''}"
                placeholder="请输入学员名称...">

            支付状态:
            <select class="form-control" name="pay_status" id="pay_status" style="width: 140px;">
                <option value=''>全部</option>
                <option value="0">未支付</option>
                <option value="1">已支付</option>
                <option value="3">已退款</option>
            </select> &nbsp;&nbsp;
            支付方式:
            <select class="form-control" name="pay_type" id="pay_type" style="width: 140px;">
                <option value=''>全部</option>
                <option value="0">微信</option>
                <option value="1">现金</option>
                <option value="2">扫码</option>
            </select> &nbsp;&nbsp;
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn btn-danger" href="{:url('AdminOrder/index')}">清空</a>
            <a class="btn btn-danger" href="{:url('ExpExcel/exportExcel',['pay_type'=>$pay_type,'start_time'=>strtotime($start_time),'end_time'=>strtotime($end_time),'subject_id'=>$subject_id,'course_id'=>$course_id,'teacher_id'=>$teacher_id,'class_id'=>$class_id,'keyword'=>$keyword,'pay_status'=>$pay_status])}">导出excel</a>
        </p>
        </form>
        <form method="post" class="js-ajax-form" action="{:url('AdminOrder/listOrder')}">
            <div class="table-actions">
            </div>

            <table class="table table-hover table-bordered table-list" id="menus-table">
                <thead>
                    <tr>
                        <th width="16" style="padding-left:20px;"><label><input type="checkbox" class="js-check-all"
                                    data-direction="x" data-checklist="js-check-x"></label></th>
                        <th width="50">ID</th>
                        <th width="150">订单号</th>
                        <th width="150">报读课程</th>
                        <th width="60">班别</th>
                        <th width="60">课室</th>
                        <th width="100">学长姓名</th>
                        <th width="100">电话</th>
                        <th width="100">学员</th>
                        <th width="100">学校</th>
                        <th width="80">金额</th>
                        <th width="80">座位号</th>
                        <th width="100">支付状态</th>
                        <th width="100">支付方式</th>
                        <th width="150">支付时间</th>
                        <th width="150">退款时间</th>
                        <th width="150">下单时间</th>
                        <th width="80">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <foreach $list as $vo>
                        <tr>
                            <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x"
                                    name="ids[]" value="{$vo.id}"></td>
                            <td>{$vo.id}</td>
                            <td>{$vo.order_no}</td>
                            <td>{$vo.course.title}</td>
                            <td>{$vo.course.schoolclass.name}</td>
                            <td>{$vo.course.classroom}</td>
                            <td>{$vo.parent_name}</td>
                            <td>{$vo.phone}</td>
                            <td>{$vo.student_name}</td>
                            <td>{$vo.current_school}</td>
                            <td>{$vo.price}</td>
                            <td>{$vo.seat}</td>
                            <td> {$vo.pay_status}</td>
                            <td> {$vo.pay_type}</td>
                            <td>{$vo['pay_time']==0?'':$vo['pay_time']}</td>
                            <td> {$vo['refund_time']==0?'':date('Y-m-d H:i',$vo['refund_time'])}</td>
                            <td> {:date('Y-m-d H:i',$vo['create_time'])}</td>
                            <td>
                                <if condition="($vo['pay_status'] ==  '已支付')">
                                    <a href="{:url('AdminOrder/editOrder',['order_id'=>$vo.id])}">编辑</a>                                    
                                </if>
                            </td>
                        </tr>
                    </foreach>
                </tbody>
                <tfoot>
                    <tr>
                        <th width="16" style="padding-left:20px;"><label><input type="checkbox" class="js-check-all"
                                    data-direction="x" data-checklist="js-check-x"></label></th>
                            <th width="50">ID</th>
                            <th width="150">订单号</th>
                            <th width="150">报读课程</th>
                            <th width="60">班别</th>
                            <th width="60">课室</th>
                            <th width="100">学长姓名</th>
                            <th width="100">电话</th>
                            <th width="100">学员</th>
                            <th width="100">学校</th>
                            <th width="80">金额</th>
                            <th width="80">座位号</th>
                            <th width="100">支付状态</th>
                            <th width="100">支付方式</th>
                            <th width="150">支付时间</th>
                            <th width="150">退款时间</th>
                            <th width="150">下单时间</th>
                            <th width="80">操作</th>
                    </tr>
                </tfoot>
            </table>
            <div class="table-actions">

            </div>
            <ul class="pagination">{$page|default=''}</ul>
        </form>
    </div>
    <script src="__STATIC__/js/admin.js"></script>
    <script type="text/javascript" src="__STATIC__/js/bootstrap.min.js"></script>
    <script>
        $('#course_id').val("{$course_id|default=''}");
        $('#subject_id').val("{$subject_id|default=''}");
        $('#class_id').val("{$class_id|default=''}");
        $('#teacher_id').val("{$teacher_id|default=''}");
        $('#pay_status').val("{$pay_status|default=''}");
        $('#pay_type').val("{$pay_type|default=''}");

        $(function () {
            $("[data-toggle='popover']").popover({
                html: true
            })
        })

        $(document).ready(function () {
            Wind.css('treeTable');
            Wind.use('treeTable', function () {
                $("#menus-table").treeTable({
                    indent: 20,
                    initialState: 'expanded'
                });
            });
        });

    </script>
</body>

</html>